from dotenv import load_dotenv
import pytest
from config.constant import ENV_FILE_PATH  # 导入.env路径

def pytest_configure(config):
    # 使用封装的.env路径（删除原硬编码）
    load_dotenv(ENV_FILE_PATH)

@pytest.fixture(scope='function')
def get_intranet():
    headers = {
        "Cookie": "JSESSIONID=258CC049DF2833A7D20B06026E8A27C0",
    }
    return headers

@pytest.fixture(scope='function')
def get_server():
    headers = {
        "Cookie": "JSESSIONID=C10D475E88C22519E4903030CC87B0DC",
    }
    return headers

# 为多线程执行添加线程安全的数据库连接
@pytest.fixture(scope='function')
def db_helper():
    """线程安全的数据库连接fixture"""
    from utils.contect_operation_db_util import DBHelper
    db_helper = DBHelper()
    yield db_helper
    db_helper.close()